<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>按钮变化</title>
    <!-- 引入css基础样式 -->
    <link rel="stylesheet" href="./css/base.css">
    <!-- 引入jQurey库 -->
    <script src="./js/jQuery.js"></script>
    <style>
        /* 文字溢出显示点点点 */
        .OverflowEllipsis{
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        body {
            display: flex;
            justify-content: flex-start;
            align-items: flex-start;
            height: 100vh;
            background-color: rgb(197, 192, 192);
        }

        .menu-navbar {
            display: flex;
            justify-content: space-between;
            position: relative;
            width: 60px;
            height: 60px;
            /* 动画变化时，过渡时间 */
            transition: height 0.5s, width 0.5s;
            transition-delay: 0s, 0.75s;
            background: #fff;
            overflow: hidden;
            border-radius: 0 5px 5px 0;
        }
        .menu-navbar.active {
            width: 300px;
            height: 400px;
            transition: width 0.5s, height 0.5s;
            transition-delay: 0s, 0.75s;
        }


        .menu-header {
            position: relative;
            /* 宽度等于父盒子宽度 - menu盒子 */
            width: calc(100% - 60px);
            height: 60px;
            overflow: hidden;
        }

        .menu-header .logo {
            position: absolute;
            top: 50%;
            left: 5px;
            transform: translate(0, -50%);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: 1px solid rgba(0,0,0,0.1);
            overflow: hidden;
        }

        .menu-header .username {
            position: absolute;
            top: 50%;
            left: 60px;
            transform: translate(0, -50%);
            width: 160px;
            height: 50px;
            overflow: hidden;
            padding: 5px;
        }

        .menu-header .username h4 {
            margin-bottom: 5px;
            font-size: 16px;
        }

        .menuControl {
            position: relative;
            width: 60px;
            height: 60px;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            /* 不允许用户光标选中 */
            user-select: none;
        }

        .menuControl::before,
        .menuControl::after {
            position: absolute;
            content: '';
            transform: translateY(-10px);
            width: 40px;
            height: 2px;
            background: #ccc;
            transition: 0.5s;
            transition-delay: 0.75s;
        }

        .menuControl::after {
            transform: translateY(10px);
        }

        .menuControl.active::before {
            transform: translateY(0) rotate(45deg);

        }

        .menuControl.active::after {
            transform: translateY(0) rotate(-45deg);  
        }

        .menuList {
            border-top: 1px solid #ccc;
            position: absolute;
            top: 60px;
            width: 100%;
            height: 100%;
            padding: 20px;
        }

        .menuList li a {
            display: block;
            margin: 20px 0;
            font-size: 1.5em;
            text-decoration: none;
        }
    </style>
    <script>
        $(function () {
            let fes = 1;
            $('.menuControl').click(function () {
                if (fes) {
                    $('.menu-navbar').addClass('active')
                    $(this).addClass('active');
                    fes = 0;
                } else {
                    $('.menu-navbar').removeClass('active')
                    $(this).removeClass('active');
                    fes = 1
                }
            })
        })
    </script>
</head>

<body>
    <div class="container">
        <!-- 侧边导航栏菜单移动端 -->
        <div class="menu-navbar">
            <div class="menu-header">
                <div class="logo">
                    <a href="#"><img src="./imgs/1.png" alt="" width="100%"></a>
                </div>
                <div class="username">
                    <h4 class="OverflowEllipsis">刻晴</h4>
                    <p class="OverflowEllipsis">这个UP很懒，什么都没写，气死人了！</p>
                </div>
            </div>
            <div class="menuControl"></div>
            <div class="menuList">
                <ul>
                    <li><a href="#">我的主页</a></li>
                    <li><a href="#">消息</a></li>
                    <li><a href="#">通知</a></li>
                    <li><a href="#">设置</a></li>
                    <li><a href="#">帮助</a></li>
                    <li><a href="#">退出</a></li>
                </ul>
            </div>
        </div>
    </div>
</body>

</html>
